<template>
	<view class="g-nav-card">
		<view class="nav-card-wrap" @click="handleClick">
			<view class="nav-pic" :style="[{'background':bgColor}]">
				<i :class="'iconfont iconSize icon-'+icon"></i>
				<slot></slot>
			</view>
			<view class="nav-title">{{title}}</view>
			<view class="notfinished-num" v-if="newtips!=0">{{newtips>99?'99+':newtips}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "nav-card",
		data() {
			return {

			};
		},
		props: {
			icon: {
				type: String,
			},
			title: {
				type: String
			},
			newtips: {
				type: Number,
				default: 0
			},
			bgColor: {
				type: String,
				default: '#c249fe'
			}
		},
		methods: {
			handleClick() {
				this.$emit('click', this.title)
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import "../../iconfont.css";

	.g-nav-card {
		position: relative;
		display: inline-block;
	}
	.nav-card-wrap {
		display: flex;
		flex-direction: column;
		align-items: center;
		.nav-pic {
			display: flex;
			justify-content: center;
			align-items: center;
			width: 88rpx;
			height: 88rpx;
			border-radius: 10rpx;
			color: #FFFFFF;
			.iconSize {
				font-size: 40rpx;
				color: #ffffff;
			}
		}
		.nav-title {
			font-size: 28rpx;
			margin-top: 4rpx;
			color: #121F2C;
		}
	}
	.notfinished-num {
		position: absolute;
		right: 0;
		bottom: 0;
		transform: translate(20%, -100%) scale(0.8);
		line-height: 26rpx;
		text-align: center;
		height: 26rpx;
		font-size: 24rpx;
		padding: 5rpx 8rpx;
		color: #FFFFFF;
		background: #ea0000;
		border-radius: 15rpx;
	}
</style>
